package at.fhh.se.tjr.client.view;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;

import at.fhh.se.tjr.client.controller.Controller;

public class MainWindow extends JFrame {

	JPanel mainPanel = new JPanel(new BorderLayout());

	JPanel top = new JPanel(new BorderLayout());

	JPanel consolePanel = new JPanel(new BorderLayout());

	MoteWrapperPanel wrapperPanel = new MoteWrapperPanel();

	NavigationPanel naviPanel;

	MessagesPanel motesPanel = new MessagesPanel();
	

	public MainWindow(Controller controller) {
		this.setName("Traffic Jam Recognition");
		this.setSize(800, 800);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
		naviPanel = new NavigationPanel(controller);
		this.setLayout(new GridLayout(2,1));
		this.initTopPanel();
		this.initConsolePanel();
	}

	public void initTopPanel() {
		top.setLayout(new GridLayout(1, 3));
		top.add(naviPanel);
		top.add(motesPanel);
		top.add(wrapperPanel);
		top.setSize(800,600);
		this.add(top, BorderLayout.CENTER);
	}

	JTextArea text = new JTextArea("Console Panel");
	public void initConsolePanel() {
		text.setBackground(Color.white);
		text.setFont(Controller.FONT);
		text.setForeground(Color.BLACK);
		text.setColumns(30);
		text.setRows(50);
//		text.setEnabled(false);
		text.setEditable(false);
		consolePanel.add(text);
		this.add(consolePanel, BorderLayout.SOUTH);
	}

	public NavigationPanel getNaviPanel() {
		return naviPanel;
	}
	
	

	public MoteWrapperPanel getWrapperPanel() {
		return wrapperPanel;
	}

	public MessagesPanel getMessagesPanel() {
		return motesPanel;
	}

	public JTextArea getText() {
		return text;
	}


}
